package com.zhiwang.planet.ui.my

import android.os.Bundle
import androidx.databinding.DataBindingUtil
import com.zhiwang.planet.R
import com.zhiwang.planet.databinding.ActivityChangeNicknameBinding
import com.zhiwang.planet.di.component.DaggerUserComponent
import com.zhiwang.planet.di.module.AccountModule
import com.zhiwang.planet.di.module.AutoDisposeModule
import com.zhiwang.planet.mvvm.viewmodel.my.ChangeNickNameViewModel
import com.zhiwang.planet.ui.BaseActivity
import kotlinx.android.synthetic.main.activity_change_nickname.*
import javax.inject.Inject

class ChangeNickNameActivity : BaseActivity() {


    @Inject
    lateinit var viewModel: ChangeNickNameViewModel

    override fun initInjection() {
        super.initInjection()
        DaggerUserComponent.builder()
                .appComponent(getAppComponent())
                .autoDisposeModule(AutoDisposeModule(this))
                .accountModule(AccountModule(this))
                .build()
                .inject(this)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val binding = DataBindingUtil.setContentView<ActivityChangeNicknameBinding>(this, R.layout.activity_change_nickname)

        setSupportActionBar(toolbar)
        binding.viewModel = viewModel
        binding.lifecycleOwner = this

        viewModel.load()
    }
}